package cn.elricyu.tt.pattern;

import java.util.ArrayList;
import java.util.List;

import cn.elricyu.tt.bean.ChatMessage;

public class MessageSubject {
	private static List<MessageObserver> observerList = new ArrayList<MessageObserver>();

	private MessageSubject() {
		super();
	}

	public static void addObserver(MessageObserver observer) {
		observerList.add(observer);

	}

	public static void notifyObservers(String key, List<ChatMessage> messageList) {
		for (MessageObserver observer : observerList) {
			observer.updateMessage(key, messageList);
		}
	}
}
